//
//  WDViewController.m
//  ZYShang
//
//  Created by wangguangming on 15/7/27.
//  Copyright © 2015年 Amber. All rights reserved.
//

#import "WDViewController.h"
#import "Base.h"
#import "Ordersignle.h"
#import "OrderMessagesignle.h"
#import "MenmView.h"
#import "DetailViewController.h"
#import "ReadyDiSignle.h"
#import "ProblemView.h"
#import "ItemView.h"
@interface WDViewController ()
{
    NSInteger _number;
    BOOL isShit;
    
    ProblemView *_problemView;
    
    UIButton *_subutton;
    UIButton *_addbutton;
    UILabel *_numberLaber;
}
@property(nonatomic,strong)UIView *headView;
@property(nonatomic,strong)UIButton *supButton;
@property(nonatomic,strong)UIButton *changgeButton;
@property(nonatomic,strong)UIButton *yudingButton;
@property(nonatomic,strong)UILabel *supLab;
@property(nonatomic,strong)UILabel *changgeLab;
@property(nonatomic,strong)UILabel *yudingLab;



@property(nonatomic,strong)UIButton *itemButton;
@property(nonatomic,strong)MenmView *menumView;
@property(nonatomic,strong)UIScrollView *mainscroll;
@end

@implementation WDViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) 
        {
        self.view.backgroundColor=COLOR;
        }
    return self;
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    [[Ordersignle single] waitDistributionsworking];
    
    [[Ordersignle single] orderWaitDistributionsworking];
    [[Ordersignle single] yudingWorking];
    [[Ordersignle single] addObserver:self forKeyPath:@"oidArray" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil]; 
    [[Ordersignle single] addObserver:self forKeyPath:@"foidArray" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil]; 
    [[Ordersignle single] addObserver:self forKeyPath:@"ydOidArr" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil]; 
    [[OrderMessagesignle single] addObserver:self forKeyPath:@"itemsArray" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];
    

}
//self.ydOidArr =[NSMutableArray arrayWithArray:array];
//self._ydidArr=[NSMutableArray arrayWithArray:array1];
-(void)viewWillDisappear:(BOOL)animated
{
     [[Ordersignle single] removeObserver:self forKeyPath:@"oidArray"];
    [[Ordersignle single] removeObserver:self forKeyPath:@"foidArray"];
    [[Ordersignle single] removeObserver:self forKeyPath:@"ydOidArr"];
    
    
    [[OrderMessagesignle single] removeObserver:self forKeyPath:@"itemsArray"];
    [super viewWillDisappear:animated];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"未配货订单";
    _number=-1;
    [self setBack];
    self.headView=[[UIView alloc] initWithFrame:CGRectMake(0, 64, WIDTH, 45)];
    self.headView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:self.headView];
    [self buju];
    [self fbuju];
    [self yudingbuju];
   
   }
-(void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id)object change:(nullable NSDictionary *)change context:(nullable void *)context
{
    if ([keyPath isEqualToString:@"oidArray"]) 
        {
            //NSLog(@"=====%@",[Ordersignle single].oidArray);
       
        
        self.itemArray=[NSMutableArray arrayWithArray:[Ordersignle single].oidArray];
      [self buju];

        } 
    if ([keyPath isEqualToString:@"itemsArray"]) 
        {
            // NSLog(@"=====%@",[OrderMessagesignle single].itemsArray);
       
        [_problemView setItemview:[OrderMessagesignle single].itemsArray];
             
        
        } 
    if ([keyPath isEqualToString:@"foidArray"]) 
        {
            //NSLog(@"=====%@",[Ordersignle single].foidArray);
        
        self.fitemArray=[NSMutableArray arrayWithArray:[Ordersignle single].foidArray];
        [self fbuju];   
        
        } 
    if ([keyPath isEqualToString:@"ydOidArr"]) 
        {
            //NSLog(@"=====%@",[Ordersignle single].foidArray);
        
        self.yitenArray=[NSMutableArray arrayWithArray:[Ordersignle single].ydOidArr];
        [self yudingbuju];   
        
        } 

    
}
-(void)buju
{
    self.supButton=[[UIButton  alloc]init];
    self.supButton.frame=CGRectMake(0, 0, WIDTH/3, 40);
    
       
    [self.supButton setTitle:[NSString stringWithFormat:@"超市订单(%d)",self.itemArray.count] forState:UIControlStateNormal];
       
      
    self.supButton.backgroundColor=[UIColor whiteColor];
   
    [self.supButton setTitleColor:BLUECOLOL forState:UIControlStateNormal];
    
    [self.supButton addTarget:self action:@selector(supAction) forControlEvents:UIControlEventTouchUpInside];
    
    [self.headView addSubview:self.supButton];
    
    self.supLab=[[UILabel alloc] initWithFrame:CGRectMake(5, 42, WIDTH/3-10, 2)];
    self.supLab.backgroundColor=BLUECOLOL;
    [self.headView addSubview:self.supLab];
    
    [self supshuju];
   
}
-(void)yudingbuju{

    self.yudingButton=[[UIButton  alloc]init];
    self.yudingButton.frame=CGRectMake( WIDTH*2/3, 0, WIDTH/3, 40);
    
    
    [self.yudingButton setTitle:[NSString stringWithFormat:@"预定订单(%d)",self.yitenArray.count] forState:UIControlStateNormal];
    
    
    self.yudingButton.backgroundColor=[UIColor whiteColor];
    
    [self.yudingButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    
    [self.yudingButton addTarget:self action:@selector(yudingAction) forControlEvents:UIControlEventTouchUpInside];
    
    [self.headView addSubview:self.yudingButton];
    
    self.yudingLab=[[UILabel alloc] initWithFrame:CGRectMake(WIDTH*2/3+5, 42, WIDTH/3-10, 2)];
    self.yudingLab.backgroundColor=[UIColor whiteColor];
    [self.headView addSubview:self.yudingLab];
    
}
-(void)fbuju
{
    
    self.changgeButton=[[UIButton alloc] init];
    self.changgeButton.frame=CGRectMake(WIDTH/3, 0, WIDTH/3, 40);
    
    [self.changgeButton setTitle:[NSString stringWithFormat:@"跳蚤订单(%d)",self.fitemArray.count] forState:UIControlStateNormal];
    self.changgeButton.backgroundColor=[UIColor whiteColor];
     [self.changgeButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
   
   
    [self.changgeButton addTarget:self action:@selector(changgeAction) forControlEvents:UIControlEventTouchUpInside];
    [self.headView addSubview:self.changgeButton];
    
    self.changgeLab=[[UILabel alloc] initWithFrame:CGRectMake(WIDTH/3+5, 42, WIDTH/3-10, 2)];
    self.changgeLab.backgroundColor=[UIColor whiteColor];
    [self.headView addSubview:self.changgeLab];
    

}
-(void)supshuju
{
    [self.mainscroll removeFromSuperview];
    self.mainscroll=[[UIScrollView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.headView.frame)+3, WIDTH, HEIGHT-CGRectGetMaxY(self.headView.frame)-5)];
    self.mainscroll.backgroundColor=COLOR;
    [self.view addSubview:self.mainscroll];

    for (int i=0; i<self.itemArray.count; i++)
        {
        
        int row=i/2;
        NSString *string=self.itemArray[i];
        NSString *b = [string substringFromIndex:string.length-6];
        
        self.itemButton=[[UIButton alloc] init];
        self.itemButton.frame=CGRectMake(6+(i%2)*(WIDTH/2-3),6+56*row, WIDTH/2-9, 50);
        self.itemButton.backgroundColor=[UIColor whiteColor];
        
        [self.itemButton setTitleColor:BLUECOLOL forState:UIControlStateNormal];
        [self.itemButton setTitle:[NSString stringWithFormat:@"%@",b] forState:UIControlStateNormal];
        
        [self.itemButton setTag:110+i];
         self.itemButton.layer.cornerRadius=4;
        self.itemButton.layer.borderColor=[[UIColor grayColor] CGColor];
       
        
        [self.itemButton addTarget:self action:@selector(turnAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.mainscroll addSubview:self.itemButton];
        
        }
    self.mainscroll.contentSize=CGSizeMake(0, (self.itemArray.count/2+1)*65+120);
}
-(void)fshuju
{
    [self.mainscroll removeFromSuperview];
    self.mainscroll=[[UIScrollView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.headView.frame)+5, WIDTH, HEIGHT-CGRectGetMaxY(self.headView.frame)-5)];
    self.mainscroll.backgroundColor=COLOR;
    [self.view addSubview:self.mainscroll];
    for (int i=0; i<self.fitemArray.count; i++)
        {
        
        int row=i/2;
        NSString *string=self.itemArray[i];
        NSString *b = [string substringFromIndex:string.length-3];
        
        self.itemButton=[[UIButton alloc] init];
        self.itemButton.frame=CGRectMake(6+(i%2)*(WIDTH/2-3),6+56*row, WIDTH/2-9, 50);
        self.itemButton.backgroundColor=[UIColor whiteColor];
        
        [self.itemButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        [self.itemButton setTitle:[NSString stringWithFormat:@"%@",b] forState:UIControlStateNormal];
        self.itemButton.layer.cornerRadius=4;
        [self.itemButton setTag:110+i];
        
        
        
        self.itemButton.layer.cornerRadius=4;
        
        [self.itemButton addTarget:self action:@selector(turnAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.mainscroll addSubview:self.itemButton];
        
        }
    self.mainscroll.contentSize=CGSizeMake(0, (self.itemArray.count/2+1)*65); 
}
-(void)yudingshuju{
    [self.mainscroll removeFromSuperview];
    self.mainscroll=[[UIScrollView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.headView.frame)+3, WIDTH, HEIGHT-CGRectGetMaxY(self.headView.frame)-5)];
    self.mainscroll.backgroundColor=COLOR;
    [self.view addSubview:self.mainscroll];
    
    for (int i=0; i<self.yitenArray.count; i++)
        {
        
        int row=i/2;
        NSString *string=self.yitenArray[i];
        NSString *b = [string substringFromIndex:string.length-3];
        
        self.itemButton=[[UIButton alloc] init];
        self.itemButton.frame=CGRectMake(6+(i%2)*(WIDTH/2-3),6+56*row, WIDTH/2-9, 50);
        self.itemButton.backgroundColor=[UIColor whiteColor];
        
        [self.itemButton setTitleColor:BLUECOLOL forState:UIControlStateNormal];
        [self.itemButton setTitle:[NSString stringWithFormat:@"%@",b] forState:UIControlStateNormal];
        
        [self.itemButton setTag:110+i];
        self.itemButton.layer.cornerRadius=4;
        self.itemButton.layer.borderColor=[[UIColor grayColor] CGColor];
        
        
        [self.itemButton addTarget:self action:@selector(yudingturnAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.mainscroll addSubview:self.itemButton];
        
        }
    self.mainscroll.contentSize=CGSizeMake(0, (self.itemArray.count/2+1)*65);

    
}
-(void)yudingturnAction:(UIButton *)sender{
    [self.menumView removeFromSuperview];
    self.menumView=[[MenmView alloc] init];
    
    self.menumView.frame=CGRectMake(CGRectGetMinX(sender.frame), CGRectGetMaxY(sender.frame)+5, sender.frame.size.width, 120);
    
    self.menumView.layer.cornerRadius=6.0;
    
    [self.mainscroll addSubview:self.menumView];
    
    
    
    [self.menumView.readyButton addTarget:self action:@selector(yreadyAction) forControlEvents:UIControlEventTouchUpInside];
    
    [self.menumView.noButton addTarget:self action:@selector(ynoAction) forControlEvents:UIControlEventTouchUpInside];
    
    [self.menumView.detailsButton addTarget:self action:@selector(ydetailsAction) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    if (sender.tag-110==_number) 
        {
        [self.menumView removeFromSuperview];
        _number=-1;
        }
    else
        {
        _number=sender.tag-110;
        }
    

    
}
-(void)turnAction:(UIButton *)sender
{
   
        [self.menumView removeFromSuperview];
        self.menumView=[[MenmView alloc] init];
        
        self.menumView.frame=CGRectMake(CGRectGetMinX(sender.frame), CGRectGetMaxY(sender.frame)+5, sender.frame.size.width, 120);
        
        self.menumView.layer.cornerRadius=6.0;
        
        [self.mainscroll addSubview:self.menumView];
        
        
        
        [self.menumView.readyButton addTarget:self action:@selector(readyAction) forControlEvents:UIControlEventTouchUpInside];
        
        [self.menumView.noButton addTarget:self action:@selector(noAction) forControlEvents:UIControlEventTouchUpInside];
        
        [self.menumView.detailsButton addTarget:self action:@selector(detailsAction) forControlEvents:UIControlEventTouchUpInside];
        
     
  
    if (sender.tag-110==_number) 
        {
         [self.menumView removeFromSuperview];
        _number=-1;
       }
    else
        {
    _number=sender.tag-110;
        }
    
    
   
}
-(void)readyAction
{
    [self.menumView removeFromSuperview]; 
    isShit=NO;
    [ReadyDiSignle signle].oidString=[Ordersignle single]._idArray[_number];
    [[ReadyDiSignle signle] readyDisWorking];
    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
    
    
    
    [nc addObserver:self
           selector:@selector(handleColorChange)
               name:@"do"
             object:nil];
    


}
-(void)yreadyAction
{
    [self.menumView removeFromSuperview]; 
    isShit=NO;
    [ReadyDiSignle signle].oidString=[Ordersignle single]._fidArray[_number];
    [[ReadyDiSignle signle] readyDisWorking];
    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
    
    
    
    [nc addObserver:self
           selector:@selector(fhandleColorChange)
               name:@"do"
             object:nil];
    
    
    
}
-(void)fhandleColorChange
{
    [[Ordersignle single] yudingWorking];
}
-(void)handleColorChange
{
    [[Ordersignle single] waitDistributionsworking];
}
-(void)noAction
{
   [self.menumView removeFromSuperview];  
    isShit=NO;
    _problemView=[[ProblemView alloc] initWithFrame:CGRectMake(20, 70, WIDTH-40, HEIGHT-140)];
    _problemView.backgroundColor=COLOR;
    
    _problemView.layer.cornerRadius=6;
    _problemView.layer.borderWidth=2.0;
    _problemView.layer.borderColor=[[UIColor whiteColor] CGColor];
    [self.view addSubview:_problemView];
//    [self.view insertSubview:_problemView aboveSubview:self.mainscroll];
    UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction)];
    
    [self.mainscroll addGestureRecognizer:tap];
    
    [OrderMessagesignle single].oidString=[Ordersignle single]._idArray[_number];
    [[OrderMessagesignle single] orderMessagworking];
    
   
    for (int i=0; i<3; i++)
        {
        UIButton *button=(UIButton *)[_problemView viewWithTag:110+i];
         [button addTarget:self action:@selector(itemAction:) forControlEvents:UIControlEventTouchUpInside];
       }
    

}
-(void)ynoAction
{
    [self.menumView removeFromSuperview];  
    isShit=NO;
    _problemView=[[ProblemView alloc] initWithFrame:CGRectMake(20, 70, WIDTH-40, HEIGHT-140)];
    _problemView.backgroundColor=[UIColor whiteColor];
    
    _problemView.layer.cornerRadius=6;
    _problemView.layer.borderWidth=3.0;
    _problemView.layer.borderColor=[[UIColor grayColor] CGColor];
    [self.view addSubview:_problemView];
        //    [self.view insertSubview:_problemView aboveSubview:self.mainscroll];
    UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction)];
    
    [self.mainscroll addGestureRecognizer:tap];
    
    [OrderMessagesignle single].oidString=[Ordersignle single]._fidArray[_number];
    [[OrderMessagesignle single] orderMessagworking];
    
    
    for (int i=0; i<2; i++)
        {
        UIButton *button=(UIButton *)[_problemView viewWithTag:110+i];
        [button addTarget:self action:@selector(fitemAction:) forControlEvents:UIControlEventTouchUpInside];
        }
    
    
}
-(void)fitemAction:(UIButton *)sender
{
    
    if ([sender.titleLabel.text isEqualToString:@"拒收"])
        {
        [ReadyDiSignle signle].oidString=[Ordersignle single]._idArray[_number];
        NSMutableArray *array=[NSMutableArray array];
        for (int i=0; i<[OrderMessagesignle single].itemsArray.count; i++)
            {
            Items *items=[OrderMessagesignle single].itemsArray[i];
                // NSLog(@"%d",items.quantity.integerValue);
            UILabel *l=(UILabel *)[_problemView viewWithTag:300+i];
            
            [array addObject:[NSString stringWithFormat:@"%d",items.quantity.integerValue-l.text.integerValue]];
            
            
            }
            //  NSLog(@"%@",array);
        NSString *a;
        for (int i=0; i<array.count; i++)
            {
            a=array[i];
            if (a.integerValue<0)
                {
                UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提醒" message:@"缺货数量大于订单数量" delegate:self cancelButtonTitle:@"重新输入" otherButtonTitles:nil, nil];
                [alert show];
                }
            else
                {
                NSString *s=@"";
                for (int i=0; i<array.count; i++)
                    {
                    s=[s stringByAppendingString:[NSString stringWithFormat:@"%@;",array[i]]];
                    }
                    // NSLog(@"%@",s);
                NSString *ss =[s substringToIndex:s.length-1];
                [[ReadyDiSignle signle] Refuseaccepts:ss];
                NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
                [nc addObserver:self
                       selector:@selector(handleColorChange)
                           name:@"do"
                         object:nil];
                
                }
            }
        }
    else
        {
        [ReadyDiSignle signle].oidString=[Ordersignle single]._fidArray[_number];
        NSMutableArray *array=[NSMutableArray array];
        for (int i=0; i<[OrderMessagesignle single].itemsArray.count; i++)
            {
            Items *items=[OrderMessagesignle single].itemsArray[i];
                // NSLog(@"%d",items.quantity.integerValue);
            UILabel *l=(UILabel *)[_problemView viewWithTag:300+i];
            
            [array addObject:[NSString stringWithFormat:@"%d",items.quantity.integerValue-l.text.integerValue]];
            
            
            }
            //  NSLog(@"%@",array);
        NSString *a;
        for (int i=0; i<array.count; i++)
            {
            a=array[i];
            if (a.integerValue<0)
                {
                UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提醒" message:@"缺货数量大于订单数量" delegate:self cancelButtonTitle:@"重新输入" otherButtonTitles:nil, nil];
                [alert show];
                }
            else
                {
                NSString *s=@"";
                for (int i=0; i<array.count; i++)
                    {
                    s=[s stringByAppendingString:[NSString stringWithFormat:@"%@;",array[i]]];
                    }
                    // NSLog(@"%@",s);
                NSString *ss =[s substringToIndex:s.length-1];
                [[ReadyDiSignle signle] readyDisWorking:ss];
                NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
                [nc addObserver:self
                       selector:@selector(fhandleColorChange)
                           name:@"do"
                         object:nil];
                
                }
            }
        
        }
    [_problemView removeFromSuperview];
}

-(void)itemAction:(UIButton *)sender
{
    if ([sender.titleLabel.text isEqualToString:@"取消"])
        {
        
        }
   else if ([sender.titleLabel.text isEqualToString:@"拒收"])
        {
         [ReadyDiSignle signle].oidString=[Ordersignle single]._idArray[_number];
        NSMutableArray *array=[NSMutableArray array];
        for (int i=0; i<[OrderMessagesignle single].itemsArray.count; i++)
            {
            Items *items=[OrderMessagesignle single].itemsArray[i];
                // NSLog(@"%d",items.quantity.integerValue);
            UILabel *l=(UILabel *)[_problemView viewWithTag:300+i];
            
        [array addObject:[NSString stringWithFormat:@"%d",items.quantity.integerValue-l.text.integerValue]];
              
            
            }
            //  NSLog(@"%@",array);
        NSString *a;
        for (int i=0; i<array.count; i++)
            {
            a=array[i];
            if (a.integerValue<0)
                {
                UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提醒" message:@"缺货数量大于订单数量" delegate:self cancelButtonTitle:@"重新输入" otherButtonTitles:nil, nil];
                [alert show];
               }
            else
                {
                NSString *s=@"";
               for (int i=0; i<array.count; i++)
                   {
                s=[s stringByAppendingString:[NSString stringWithFormat:@"%@;",array[i]]];
                  }
                    // NSLog(@"%@",s);
                NSString *ss =[s substringToIndex:s.length-1];
                [[ReadyDiSignle signle] Refuseaccepts:ss];
                NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
                [nc addObserver:self
                       selector:@selector(handleColorChange)
                           name:@"do"
                         object:nil];

                }
            }
    }
    else
        {
        [ReadyDiSignle signle].oidString=[Ordersignle single]._idArray[_number];
        NSMutableArray *array=[NSMutableArray array];
        for (int i=0; i<[OrderMessagesignle single].itemsArray.count; i++)
            {
            Items *items=[OrderMessagesignle single].itemsArray[i];
                // NSLog(@"%d",items.quantity.integerValue);
            UILabel *l=(UILabel *)[_problemView viewWithTag:300+i];
            
            [array addObject:[NSString stringWithFormat:@"%d",items.quantity.integerValue-l.text.integerValue]];
            
            
            }
            //  NSLog(@"%@",array);
        NSString *a;
        for (int i=0; i<array.count; i++)
            {
            a=array[i];
            if (a.integerValue<0)
                {
                UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提醒" message:@"缺货数量大于订单数量" delegate:self cancelButtonTitle:@"重新输入" otherButtonTitles:nil, nil];
                [alert show];
                }
            else
                {
                NSString *s=@"";
                for (int i=0; i<array.count; i++)
                    {
                    s=[s stringByAppendingString:[NSString stringWithFormat:@"%@;",array[i]]];
                    }
                    // NSLog(@"%@",s);
                NSString *ss =[s substringToIndex:s.length-1];
                [[ReadyDiSignle signle] readyDisWorking:ss];
                NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
                [nc addObserver:self
                       selector:@selector(handleColorChange)
                           name:@"do"
                         object:nil];
                
                }
            }

        }
     [_problemView removeFromSuperview];
}
-(void)tapAction
{
    [_problemView removeFromSuperview];
}
-(void)detailsAction
{
    [self.menumView removeFromSuperview];
    isShit=NO;

    [OrderMessagesignle single].oidString=[Ordersignle single]._idArray[_number];
    [[OrderMessagesignle single] orderMessagworking];
    
    
    DetailViewController *detailViewController=[[DetailViewController alloc] init];
    
    
    detailViewController.typeString=@"未配货";
    [self.navigationController pushViewController:detailViewController animated:YES];
}
-(void)ydetailsAction
{
    [self.menumView removeFromSuperview];
    isShit=NO;
    
    [OrderMessagesignle single].oidString=[Ordersignle single]._fidArray[_number];
    [[OrderMessagesignle single] orderMessagworking];
    
    
    DetailViewController *detailViewController=[[DetailViewController alloc] init];
    
    
    detailViewController.typeString=@"未配货";
    [self.navigationController pushViewController:detailViewController animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)changgeAction
{
    self.supButton.backgroundColor=[UIColor whiteColor];
    [self.supButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    self.yudingButton.backgroundColor=[UIColor whiteColor];
    [self.yudingButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    self.changgeButton.backgroundColor=[UIColor whiteColor];
    [self.changgeButton setTitleColor:BLUECOLOL forState:UIControlStateNormal];
    [self fshuju];
    self.yudingLab.backgroundColor=[UIColor whiteColor];
    self.changgeLab.backgroundColor=BLUECOLOL;
    self.supLab.backgroundColor=[UIColor whiteColor];

    
}
-(void)supAction
{
    self.changgeButton.backgroundColor=[UIColor whiteColor];
    [self.changgeButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    self.yudingButton.backgroundColor=[UIColor whiteColor];
    [self.yudingButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    self.supButton.backgroundColor=[UIColor whiteColor];
    [self.supButton setTitleColor:BLUECOLOL forState:UIControlStateNormal];
    [self supshuju];
    self.yudingLab.backgroundColor=[UIColor whiteColor];
    self.changgeLab.backgroundColor=[UIColor whiteColor];
    self.supLab.backgroundColor=BLUECOLOL;
}
-(void)yudingAction{
    self.changgeButton.backgroundColor=[UIColor whiteColor];
    [self.changgeButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    self.supButton.backgroundColor=[UIColor whiteColor];
    [self.supButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    self.yudingButton.backgroundColor=[UIColor whiteColor];
    [self.yudingButton setTitleColor:BLUECOLOL forState:UIControlStateNormal];
   
    self.yudingLab.backgroundColor=BLUECOLOL;
    self.changgeLab.backgroundColor=[UIColor whiteColor];
    self.supLab.backgroundColor=[UIColor whiteColor];
    [self yudingshuju];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
